package gui;

import framework.GameContext;
import framework.GraphicsWrapper;
import framework.Rectangle;
import framework.Screen;
import gamebackend.GameSession;
import gamebackend.GameSession.FlierListener;
import gamebackend.LaserShip;

public class FlierPlayScreen extends Screen implements FlierListener {

	private VerticalStackContainer my_root;
	private GameSession my_session;
	private Screen my_controls;
	public FlierPlayScreen(GameContext the_game) {
		super(the_game);
		// TODO Auto-generated constructor stub
		Label label = new Label("Resume");
		my_root = new VerticalStackContainer();
		my_root.add(label);
		my_root.add(new Label("Restart"));
		my_root.add(new Label("Quit"));
		my_root.add(new Label("Options"));
		my_session = new GameSession(the_game, this, LaserShip.class);
		my_controls = new TouchToFlyOverlay(the_game, my_session);
		
	}

	@Override
	public void step(int the_deltaTime) {
		my_session.step(the_deltaTime);
		
	}
	@Override
	public void resize(final int the_width, final int the_height) {
		GraphicsWrapper g = my_game.getGraphicsWrapper();
		
		my_root.setMaxSize(new Rectangle(g.getWidth(), g.getHeight()));
	}

	@Override
	public void render() {
		my_game.getGraphicsWrapper().saveMatrix();
		my_session.render();
		my_game.getGraphicsWrapper().restoreMatrix();
		my_root.render(my_game.getGraphicsWrapper());
	}

	@Override
	public void dispose() {
		my_session.dispose();
		
	}
	@Override
	public void keyPressed(final int the_key) {
		my_controls.keyPressed(the_key);
	}
	@Override
	public void keyReleased(final int the_key) {
		my_controls.keyReleased(the_key);
	}

	@Override
	public void onGameEnded(int the_time, int the_score, long the_seed) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void onPause() {
		// TODO Auto-generated method stub
		
	}

}
